import pyautogui
import time

# 鼠标移动
# pyautogui.moveTo(0, 0)
# 鼠标移动时间
# pyautogui.moveTo(0, 0, 2)


#移动鼠标到相对位置 X轴+100 Y轴-100
# pyautogui.move(100, -100, 3)


# 获取屏幕分辨率 Size(width=3840, height=2160)
x,y = pyautogui.size()
print('屏幕分辨率',x,y)

# 获取鼠标位置的坐标值
mouse_x, mouse_y = pyautogui.position()
print("鼠标位置:", mouse_x, mouse_y)
#检测指定坐标是否在屏幕上
# print("(100, 100)坐标是否在屏幕上:", pyautogui.onScreen(100, 100))
# while True:
#     # 获取鼠标当前的 x 和 y 坐标
#     x, y = pyautogui.position()
#     print(f"【实时获取】当前鼠标位置: X = {x}, Y = {y}")
#     time.sleep(0.1)

